package com.huluobo.lib_base.room

import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

/**
 *  Created by LC on 2025/8/21.
 */
@Module
@InstallIn(SingletonComponent::class)
object DataModule {

    @Provides
    @Singleton
    fun initDb(@ApplicationContext context: Context): AppDatabase {
        return AppDatabase.init(context)
    }

    @Provides
    fun getUserDao(database: AppDatabase): UserDao {
        return database.userDao()
    }

    @Provides
    fun getVideoDao(database: AppDatabase): VideoDao {
        return database.videoDao()
    }
}